package com.example.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;

import com.example.bean.Banner;
import com.example.fruit.R;
import com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridView;
import com.felipecsl.asymmetricgridview.library.widget.AsymmetricGridViewAdapter;
import com.lidroid.xutils.BitmapUtils;

import java.util.List;
public class AsyAdapter extends AppBaseAdapter<String> {
    BitmapUtils bitmapUtils;

    public AsyAdapter(Context context, List<String> list) {
        super(context, list);
        bitmapUtils = new BitmapUtils(context);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_asymmetric_grideview, viewGroup, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        bitmapUtils.display(holder.img,list.get(position));
        return convertView;
    }


    private class ViewHolder {
        ImageView img;

        public ViewHolder(View itemView) {
            this.img = (ImageView) itemView.findViewById(R.id.image_asymmetric_grideView);
        }
    }
}
